package com.lepu.app.main.pay.bean;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

public class WxPayBean {

	public String RetCode;// 微信返回状态码
	public String RetMsg;// 微信返回消息
	public String AppID;// 童梦微信ID
	public String PartnerID;// 商户ID
	public String Noncestr;// 随机串
	public String Package;// Package字段
	public String PrepayID;// 预支付ID
	public String Timestamp;// 时间戳
	public String Sign;// 签名
	public String TradeNo;// 交易No
	
	/*
	 * 解析数据
	 */
	public static WxPayBean parseJsonData(String dataString)
	{
		String result = "";
		try {
			JSONObject jsonObject = new JSONObject(dataString);
			JSONObject obj1 = (JSONObject) jsonObject.get("Result");
			JSONObject obj2 = (JSONObject) obj1.get("DetailInfo");
			
			result = obj2.toString();
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		Gson gson = new Gson();
		WxPayBean item = gson.fromJson(result,
				new TypeToken<WxPayBean>() {
				}.getType());
		return item;
	}

}
